home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_084 / ed / del.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  726b  |  39 lines

  1. /*
  2.  * Copyright 1987 Brian Beattie Rights Reserved.
  3.  *
  4.  * Permission to copy and/or distribute granted under the
  5.  * following conditions:
  6.  *
  7.  * 1). No charge may be made other than resonable charges
  8.  *    for reproduction.
  9.  *
  10.  * 2). This notice must remain intact.
  11.  *
  12.  * 3). No further restrictions may be added.
  13.  *
  14.  */
  15. #include <stdio.h>
  16. #include "tools.h"
  17. #include "ed.h"
  18.  
  19. del(from, to)
  20. int    from, to;
  21. {
  22.     LINE    *first, *last, *next, *tmp;
  23.  
  24.     if(from < 1)
  25.         from = 1;
  26.     first = getptr(prevln(from));
  27.     last = getptr(nextln(to));
  28.     next = first->l_next;
  29.     while(next != last && next != &line0)
  30.     {
  31.         tmp = next->l_next;
  32.         free(next);
  33.         next = tmp;
  34.     }
  35.     relink(first, last, first, last);
  36.     lastln -= (to - from)+1;
  37.     curln = prevln(from);
  38. }
  39.